using System;
using System.Collections.Generic;

using EntModApp.EntServices.Data;

namespace DemoApp.DataAccess 
{
  public static class SubjectPropertyNames
  {
    public const string SubjectId = @"SubjectId"; 

    public const string Url = @"Url"; 

    public const string Title = @"Title"; 

    public const string Description = @"Description"; 

    public const string ImageUrl = @"ImageUrl"; 

    public const string CreateDate = @"CreateDate"; 

    public const string ModifyDate = @"ModifyDate"; 

    public const string IsDisabled = @"IsDisabled"; 

  }

  public static class SubjectReferenceNames
  {
    public const string Creator = @"Creator"; 

    public const string Editors = @"Editors"; 

    public const string ParentSubject = @"ParentSubject"; 

    public const string SubSubjects = @"SubSubjects"; 

  }

  [Serializable]
  public partial class SubjectLoadSettings 
  {

    public SubjectLoadSettings()
    {
      AsReadonly = false;

      OnCreate();
    }

    public bool AsReadonly { get; set; }

    private SubjectFilterExpression filter;
    public SubjectFilterExpression Filter 
    { 
      get 
      { 
        filter = SubjectFilterExpression.FromSubjectFilterExpression(filter);
        return filter; 
      }
      set { filter = value; }
    }

    private SubjectSelectionSettings selection;
    public SubjectSelectionSettings Selection 
    { 
      get 
      { 
        selection = SubjectSelectionSettings.FromSubjectSelectionSettings(selection);
        return selection; 
      }
      set { selection = value; }
    }

    private SubjectInclusionSettings inclusion;
    public SubjectInclusionSettings Inclusion 
    { 
      get 
      { 
        inclusion = SubjectInclusionSettings.FromSubjectInclusionSettings(inclusion);
        return inclusion; 
      }
      set { inclusion = value; }
    }

    private SubjectSortingSettings sorting;
    public SubjectSortingSettings Sorting 
    { 
      get 
      { 
        sorting = SubjectSortingSettings.FromSubjectSortingSettings(sorting);
        return sorting; 
      }
      set { sorting = value; }
    }

    private PagingSettings paging;
    public PagingSettings Paging 
    { 
      get 
      { 
        if (paging == null) paging = new PagingSettings();
        return paging; 
      }
      set { paging = value; }
    }

    partial void OnCreate();

    protected virtual void CopyFrom(SubjectLoadSettings other)
    {
      if (other != null)
      {
        filter     = other.filter;
        selection  = other.selection;
        sorting    = other.sorting;
        inclusion  = other.inclusion;
        paging     = other.paging;
      }
    }

    public static SubjectLoadSettings FromSubjectLoadSettings(SubjectLoadSettings other)
    {
      if (other != null) return other;
      var result = new SubjectLoadSettings();
      return result;
    }

  }

  [Serializable]
  public partial class SubjectFilterExpression 
  {
    public SubjectKey ByKey { get; set; }

    public int? Skip { get; set; }

    public int? Take { get; set; }

    public SimpleFilterExpression<Guid> SubjectIdFilter { get; set; }

    public SimpleFilterExpression<string> UrlFilter { get; set; }

    public SimpleFilterExpression<string> TitleFilter { get; set; }

    public SimpleFilterExpression<string> DescriptionFilter { get; set; }

    public SimpleFilterExpression<string> ImageUrlFilter { get; set; }

    public SimpleFilterExpression<DateTime> CreateDateFilter { get; set; }

    public SimpleFilterExpression<DateTime> ModifyDateFilter { get; set; }

    public SimpleFilterExpression<bool> IsDisabledFilter { get; set; }

    partial void OnCreate();

    protected virtual void CopyFrom(SubjectFilterExpression other)
    {
      if (other != null)
      {
        ByKey = other.ByKey;
        Skip = other.Skip;
        Take = other.Take;
      }
    }

    public static SubjectFilterExpression FromSubjectFilterExpression(SubjectFilterExpression other)
    {
      if (other != null) return other;
      var result = new SubjectFilterExpression();
      return result;
    }

  }

  [Serializable]
  public partial class SubjectSelectionSettings 
  {
    public SubjectSelectionSettings()
    {
      SelectSubjectId = true;
      SelectUrl = true;
      SelectTitle = true;
      SelectDescription = true;
      SelectImageUrl = true;
      SelectCreateDate = true;
      SelectModifyDate = true;
      SelectIsDisabled = true;

      OnCreate();
    }

    public bool SelectSubjectId { get; set; } 

    public bool SelectUrl { get; set; } 

    public bool SelectTitle { get; set; } 

    public bool SelectDescription { get; set; } 

    public bool SelectImageUrl { get; set; } 

    public bool SelectCreateDate { get; set; } 

    public bool SelectModifyDate { get; set; } 

    public bool SelectIsDisabled { get; set; } 

    partial void OnCreate();

    protected virtual void CopyFrom(SubjectSelectionSettings other)
    {
      if (other != null)
      {
        SelectSubjectId = other.SelectSubjectId;
        SelectUrl = other.SelectUrl;
        SelectTitle = other.SelectTitle;
        SelectDescription = other.SelectDescription;
        SelectImageUrl = other.SelectImageUrl;
        SelectCreateDate = other.SelectCreateDate;
        SelectModifyDate = other.SelectModifyDate;
        SelectIsDisabled = other.SelectIsDisabled;
      }
    }

    public static SubjectSelectionSettings FromSubjectSelectionSettings(SubjectSelectionSettings other)
    {
      if (other != null) return other;
      var result = new SubjectSelectionSettings();
      return result;
    }

  }

  [Serializable]
  public partial class SubjectInclusionSettings 
  {
    public SubjectInclusionSettings()
    {
      OnCreate();
    }

    public bool IncludeCreator { get; set; }
    private UserLoadSettings includedCreatorSettings;
    public UserLoadSettings IncludedCreatorSettings 
    { 
      get
      {
        includedCreatorSettings = UserLoadSettings.FromUserLoadSettings(includedCreatorSettings);
        return includedCreatorSettings;
      } 
      set
      {
        includedCreatorSettings = value;
      }
    }

    public bool IncludeEditors { get; set; }
    private UserLoadSettings includedEditorsSettings;
    public UserLoadSettings IncludedEditorsSettings 
    { 
      get
      {
        includedEditorsSettings = UserLoadSettings.FromUserLoadSettings(includedEditorsSettings);
        return includedEditorsSettings;
      } 
      set
      {
        includedEditorsSettings = value;
      }
    }

    public bool IncludeParentSubject { get; set; }
    private SubjectLoadSettings includedParentSubjectSettings;
    public SubjectLoadSettings IncludedParentSubjectSettings 
    { 
      get
      {
        includedParentSubjectSettings = SubjectLoadSettings.FromSubjectLoadSettings(includedParentSubjectSettings);
        return includedParentSubjectSettings;
      } 
      set
      {
        includedParentSubjectSettings = value;
      }
    }

    public bool IncludeSubSubjects { get; set; }
    private SubjectLoadSettings includedSubSubjectsSettings;
    public SubjectLoadSettings IncludedSubSubjectsSettings 
    { 
      get
      {
        includedSubSubjectsSettings = SubjectLoadSettings.FromSubjectLoadSettings(includedSubSubjectsSettings);
        return includedSubSubjectsSettings;
      } 
      set
      {
        includedSubSubjectsSettings = value;
      }
    }


    partial void OnCreate();

    protected virtual void CopyFrom(SubjectInclusionSettings other)
    {
      if (other != null)
      {
        IncludeCreator = other.IncludeCreator;
        includedCreatorSettings = other.includedCreatorSettings;
        IncludeEditors = other.IncludeEditors;
        includedEditorsSettings = other.includedEditorsSettings;
        IncludeParentSubject = other.IncludeParentSubject;
        includedParentSubjectSettings = other.includedParentSubjectSettings;
        IncludeSubSubjects = other.IncludeSubSubjects;
        includedSubSubjectsSettings = other.includedSubSubjectsSettings;
      }
    }

    public static SubjectInclusionSettings FromSubjectInclusionSettings(SubjectInclusionSettings other)
    {
      if (other != null) return other;
      var result = new SubjectInclusionSettings();
      return result;
    }

  }

  [Serializable]
  public partial class SubjectSortingSettings 
  {
    public SubjectSortingSettings()
    {
      OnCreate();
    }


    partial void OnCreate();

    protected virtual void CopyFrom(SubjectSortingSettings other)
    {
      if (other != null)
      {
      }
    }

    public static SubjectSortingSettings FromSubjectSortingSettings(SubjectSortingSettings other)
    {
      if (other != null) return other;
      var result = new SubjectSortingSettings();
      return result;
    }

  }
}
